package com.gzsxy.esjy.service.netty.common.lock;

/**
 * 锁
 * @author zhangxiaolong
 * @date 2022/7/11 9:36
 */
public class Lock {

	private final String key ;
	
	private String group = DistributedLock.DEFAULT_DEVICE;
	
	/**
	 * 最大等待时间(毫秒)
	 */
	private long maxWaitTime = 1000 ;
	
	/**
	 * 尝试时间间隔(毫秒)
	 */
	private long timeInterval = 2 ;
	
	/**
	 * 超时提示
	 */
	private String failMsg ="当前系统繁忙,请重新请求" ;

	public Lock(String key, String group, long maxWaitTime, long timeInterval) {
		super();
		this.key = key;
		this.group = group;
		this.maxWaitTime = maxWaitTime;
		this.timeInterval = timeInterval;
	}

	public Lock(String key) {
		super();
		this.key = key;
	}
	

	public Lock(String key, String group) {
		super();
		this.key = key;
		this.group = group;
	}
	
	

	public Lock(String key, String group, long maxWaitTime, long timeInterval, String failMsg) {
		super();
		this.key = key;
		this.group = group;
		this.maxWaitTime = maxWaitTime;
		this.timeInterval = timeInterval;
		this.failMsg = failMsg;
	}

	public String getKey() {
		return key;
	}

	public String getGroup() {
		return group;
	}

	public long getMaxWaitTime() {
		return maxWaitTime;
	}

	public Lock setMaxWaitTime(long maxWaitTime) {
		this.maxWaitTime = maxWaitTime;
		return this ;
	}

	public long getTimeInterval() {
		return timeInterval;
	}

	public Lock setTimeInterval(long timeInterval) {
		this.timeInterval = timeInterval;
		return this ;
	}

	public String getFailMsg() {
		return failMsg;
	}

	public Lock setFailMsg(String failMsg) {
		this.failMsg = failMsg;
		return this ;
	}
	
	
}
